home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
dll_gen
/
drvplus
/
drvplus.bas
< prev
next >
Wrap
BASIC Source File
|
1994-06-06
|
10KB
|
246 lines
'DrvPlus.DLL should be in your Windows\System directory or in the Path
'RAM information
Declare Function GetRamSize& Lib "DrvPlus.DLL" (ByVal RamType%)
Global Const BaseRam = 1
Global Const HwRam = 2
Global Const ExtRam = 3
Global Const TotalRam = 4
'Drive Information
Declare Function HowManyFloppies% Lib "DrvPlus.DLL" ()
Declare Function SetDefaultDrive% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function GetDefaultDrive% Lib "DrvPlus.DLL" ()
Declare Function GetBootDrive% Lib "DrvPlus.DLL" ()
Declare Function GetDriveFree& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function GetDriveSize& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
'if return value of GetDriveSize& is 0, then the drive is invalid
Declare Function GetDriveUsed& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function GetClustersOnDrive& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function GetSectorsPerCluster& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function GetBytesPerSector& Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function HowManyCDdrives% Lib "DrvPlus.DLL" ()
Declare Function IsDriveCD% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function IsDriveRemovable% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function IsDriveLocal% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function IsDriveLocalShared% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
Declare Function IsDriveSubst% Lib "DrvPlus.DLL" (ByVal DriveNbr%)
'file functions
Declare Function SetVolName% Lib "DrvPlus.DLL" (ByVal DriveNbr%, ByVal lpVolName$)
Declare Function SetFileDate% Lib "DrvPlus.DLL" (ByVal lpString$, ByVal TheYear%, ByVal TheMonth%, ByVal TheDate%)
'SetFileDate returns true if successful; else false
Declare Function SetFileTime% Lib "DrvPlus.DLL" (ByVal lpString$, ByVal TheHours%, ByVal TheMinutes%)
'SetFileTime returns true if successful; else false
'hours range=0-23
'minutes range=0-59
Declare Sub ExtFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
Declare Sub FileNameOnlyFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
Declare Sub FullFileNameFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
Declare Sub DirFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
Declare Sub DriveFromPath Lib "DrvPlus.DLL" (ByVal lpFullPath$, ByVal lpString$)
Declare Function DoesFileExist% Lib "DrvPlus.DLL" (ByVal lpString$)
'Data manapilation functions
Declare Function GetHighByte% Lib "DrvPlus.DLL" (ByVal OrgInt%)
Declare Function GetLowByte% Lib "DrvPlus.DLL" (ByVal OrgInt%)
Declare Function GetHighWord& Lib "DrvPlus.DLL" (ByVal OrgLong&)
Declare Function GetLowWord& Lib "DrvPlus.DLL" (ByVal OrgLong&)
Declare Function PeekByte% Lib "DrvPlus.DLL" (ByVal TheSegment%, ByVal TheOffset%)
'TheSegment and TheOffset should be a HexValue
Declare Sub PokeByte Lib "DrvPlus.DLL" (ByVal TheSegment%, ByVal TheOffset%, ByVal PokeValue%)
'DrvPlus assorted functions
Declare Function GetDrvPlusVersion% Lib "DrvPlus.DLL" ()
'API assorted functions
Declare Function GetWindowsDirectory% Lib "Kernel" (ByVal lpBuffer$, ByVal nSize%)
Declare Function OutMessage% Lib "User" Alias "SendMessage" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, lParam As Any)
Declare Function SendMessage& Lib "User" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, lParam As Any)
Declare Function WinHelp% Lib "User" (ByVal hWnd%, ByVal lpHelpFile$, ByVal wCommand%, ByVal dwData As Any)
Global Const HELP_CONTENTS = &H3
Global Const HELP_PARTIALKEY = &H105
'program constants
Global Const raised = 1
Global Const sunken = 2
'program variables
Global TheDateWord As String
Global TheYear As String
Global TheMonth As String
Global TheDate As String
Global TheTimeWord As String
Global TheHours As String
Global TheMinutes As String
Global FormPassString As String 'used to pass strings
Global FormPassString2 As String
Function AddSeparator (ThePath$)
If Right$(ThePath$, 1) <> "\" Then
ThePath$ = ThePath$ + "\"
End If
AddSeparator = ThePath$
End Function
Sub DoControl3D (Obj As Control, Style%, Thick%)
If Thick <= 0 Then Thick = 1
If Thick > 8 Then Thick = 8
OldMode = Obj.Parent.ScaleMode
OldWidth = Obj.Parent.DrawWidth
Obj.Parent.ScaleMode = 3
Obj.Parent.DrawWidth = 1
ObjHeight = Obj.Height
ObjWidth = Obj.Width
ObjLeft = Obj.Left
ObjTop = Obj.Top
Select Case Style
Case sunken:
TLshade = QBColor(8)
BRshade = QBColor(15)
Case raised:
TLshade = QBColor(15)
BRshade = QBColor(8)
End Select
For i = 1 To Thick
CurLeft = ObjLeft - i
CurTop = ObjTop - i
CurWide = ObjWidth + (i * 2) - 1
CurHigh = ObjHeight + (i * 2) - 1
Obj.Parent.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
Obj.Parent.Line -Step(0, CurHigh), BRshade
Obj.Parent.Line -Step(-CurWide, 0), BRshade
Obj.Parent.Line -Step(0, -CurHigh), TLshade
Next i
If Thick > 2 Then
CurLeft = ObjLeft - Thick - 1
CurTop = ObjTop - Thick - 1
CurWide = ObjWidth + ((Thick + 1) * 2) - 1
CurHigh = ObjHeight + ((Thick + 1) * 2) - 1
Obj.Parent.Line (CurLeft, CurTop)-Step(CurWide, 0), QBColor(0)
Obj.Parent.Line -Step(0, CurHigh), QBColor(0)
Obj.Parent.Line -Step(-CurWide, 0), QBColor(0)
Obj.Parent.Line -Step(0, -CurHigh), QBColor(0)
End If
Obj.Parent.ScaleMode = OldMode
Obj.Parent.DrawWidth = OldWidth
End Sub
Sub DoForm3D (TheForm As Form, Style%, Thick%, Distance%)
If Thick <= 0 Then Thick = 1
If Thick > 8 Then Thick = 8
If Distance < 0 Then Distance = 0
If Distance > 8 Then Distance = 8
OldMode = TheForm.ScaleMode
OldWidth = TheForm.DrawWidth
TheForm.ScaleMode = 3
TheForm.DrawWidth = 1
FormHeight = TheForm.ScaleHeight
FormWidth = TheForm.ScaleWidth
FormLeft = TheForm.ScaleLeft
FormTop = TheForm.ScaleTop
Select Case Style
Case sunken:
TLshade = QBColor(8)
BRshade = QBColor(15)
Case raised:
TLshade = QBColor(15)
BRshade = QBColor(8)
End Select
Select Case TheForm.BorderStyle
Case 0:
OLshade = QBColor(0)
TheForm.Line (0, 0)-(FormWidth, 0), OLshade
TheForm.Line (0, 0)-(0, FormHeight), OLshade
TheForm.Line (FormWidth - 1, 0)-(FormWidth - 1, FormHeight + 1), OLshade
TheForm.Line (0, FormHeight - 1)-(FormWidth, FormHeight - 1), OLshade
For i = 1 To Thick
CurLeft = FormLeft + i + Distance
CurTop = FormTop + i + Distance
CurWide = FormWidth - (i + Distance) * 2 - 1
CurHigh = FormHeight - (i + Distance) * 2 - 1
TheForm.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
TheForm.Line -Step(0, CurHigh), BRshade
TheForm.Line -Step(-CurWide, 0), BRshade
TheForm.Line -Step(0, -CurHigh), TLshade
Next i
Case 1 To 3:
If Thickness = 1 Then
TheForm.Line (Thick, Thick)-(FormWidth - Thick, Thick), TLshade
TheForm.Line (Thick, Thick)-(Thick, FormHeight - Thick), TLshade
TheForm.Line (FormWidth - Thick, Thick)-(FormWidth - Thick, FormHeight - Thick + 1), BRshade
TheForm.Line (Thick, FormHeight - Thick)-(FormWidth - Thick, FormHeight - Thick), BRshade
Else
For i = 1 To Thick
CurLeft = FormLeft + i - 1 + Distance
CurTop = FormTop + i - 1 + Distance
CurWide = FormWidth - (i + Distance) * 2 + 1
CurHigh = FormHeight - (i + Distance) * 2 + 1
TheForm.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
TheForm.Line -Step(0, CurHigh), BRshade
TheForm.Line -Step(-CurWide, 0), BRshade
TheForm.Line -Step(0, -CurHigh), TLshade
Next i
End If
End Select
TheForm.ScaleMode = OldMode
TheForm.DrawWidth = OldWidth
End Sub
Sub FormCenterForm (TheForm As Form, MainForm As Form)
TheForm.Move MainForm.Left + (MainForm.Width - TheForm.Width) / 2, MainForm.Top + (MainForm.Height - TheForm.Height) / 2
End Sub
Sub FormCenterScreen (TheForm As Form)
TheForm.Move (Screen.Width - TheForm.Width) / 2, (Screen.Height - TheForm.Height) / 2
End Sub
Function GetWinDir ()
Buffer$ = Space$(255)
count% = GetWindowsDirectory(Buffer$, 255)
GetWinDir = Left$(Buffer$, count%)
End Function
Sub ListHscroll (TheListBox As Control, CharsWide%)
If CharsWide% > 15000 Then CharsWide% = 15000
LongString$ = String$(CharsWide%, "W")
tppx% = Screen.TwipsPerPixelX
MaxiWide% = TheListBox.Parent.TextWidth(LongString$) / tppx%
HscrollLen& = SendMessage(TheListBox.hWnd, 1045, MaxiWide%, 0)
End Sub
Function Strip (x As String, y As String)
Dim z As String
If Len(x) < 1 Or Len(y) < 1 Then
Strip = ""
Exit Function
End If
Start = 1
z = x
Do
pos% = InStr(x, y)
If pos% = 0 Then Strip = z: Exit Function
z = Left$(x, (pos% - 1)) + Mid$(x, pos% + Len(y), Len(x) - Len(y) - pos% + 1)
If Start = Len(x) Then Exit Do
Start = Start + 1
Loop
Strip = z
End Function
Sub TrimAtNull (TheWord$)
pos% = InStr(TheWord$, Chr$(0))
If pos% = 0 Then Exit Sub
TheWord$ = Left$(TheWord$, pos% - 1)
End Sub